#include "StdAfx.h"
#include "MyHsmMessageHandlerAO.h"
#include "MyPayload.h"
#include "TypeIds.h"
#include "DefaultConfig.h"

namespace CO { namespace MyGroupNamespace { namespace MyPackageNamespace {

MyHsmMessageHandlerAO::MyHsmMessageHandlerAO(void) :
	//
	// Initialize Base class.
	//
	ActiveObject(PORT_COUNT,
		SpiFoundation::RoomFW::ActiveObject::PortPriorityArray(&PortPriorities[0], &PortPriorities[PortPrioritiesSize])),
	//
	// TODO:  Initialize attributes.
	//
	messageHandler_(),
	myConfigValue_(0)	// TODO:  Initialize attributes to default!
{
}

MyHsmMessageHandlerAO::~MyHsmMessageHandlerAO(void)
{
}

bool MyHsmMessageHandlerAO::initialize(SpiFoundation::Configuration::ConfigKey& configRoot)
{
	//
	// TODO:  Initialize attributes with configuration settings.  Get key and value
	//		  will create if they don't exist, so be sure everyone uses the same defines
	//		  to avoid spelling errors!
	//
	configRoot.getValue_T(CFG_VAL_PATH_MyIntValue, myConfigValue_);

	//
	// TODO: Instantiate message handler.  Maybe real or sim based on config value.
	//
	messageHandler_.reset(new MyHsmMessageHandler(this));
	this->clearMessageHandlers();
	this->mapMessageHandler(SpiFoundation::RoomFW::PortIndex::INVALID, messageHandler_);
	return true;
}

SpiFoundation::RoomFW::ObjectId MyHsmMessageHandlerAO::getObjectId(void) const
{
	//
	// TODO:  Return a unique id for your object.
	//
	return OID_MY_HSM_MESSAGE_HANDLER_ID;
}

const char* MyHsmMessageHandlerAO::getObjectName(void) const
{
	//
	// TODO:  Add text for your object name for debugging.
	//
	return "MyHsmMessageHandlerAO";
}

}}} // End namespace
